package com.lkeqi.usercenter.utils;

import com.lkeqi.usercenter.common.BaseResponse;
import com.lkeqi.usercenter.enums.ErrorCode;
import lombok.Data;

@Data
public class ResultUtils<T> {

    public static <T> BaseResponse<T>  success(T data) {
        return new BaseResponse<>(200,data,"success");
    }

    public static <T> BaseResponse<T>  success(T data ,String msg) {
        return new BaseResponse<>(200,data,msg);
    }

    public static <T> BaseResponse<T> fail(ErrorCode errorCode) {
        return new BaseResponse<>(errorCode);
    }

    public static <T> BaseResponse<T> fail(int errorCode,String message) {
        return new BaseResponse<>(errorCode,null,message);
    }
}
